package com.gao.orange.order;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author jinYuLinLang
 * @version 1.0.0
 * @ClassName OrderController.java
 * @Description <p></p>
 * @createTime 2021-03-08 21:04:00
 */
@RestController
@RequestMapping
@RefreshScope
public class OrderController {
    @Autowired
    private RestTemplate restTemplate;

    @Value("${member.name}")
    private String memberName;

    @Value("${member.age}")
    private Integer age;


    @GetMapping("order")
    public String order() {
        return "18.0元" + restTemplate.getForObject("http://course-service/course", String.class) + " " + memberName + " " + age;
    }

}
